import * as THREE from 'three'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'

const opt = {
  width: window.innerWidth - 180,
  height: window.innerHeight
}
const perspectiveCameraOpt = [75, opt.width/opt.height, 0.001, 10000]


export default class THREEProject{
  scene = new THREE.Scene()
  renderer = new THREE.WebGLRenderer()
  axes = new THREE.AxesHelper(70)
  camera = new THREE.PerspectiveCamera(...perspectiveCameraOpt)
  controls = new OrbitControls(this.camera, this.renderer.domElement)

  thr = THREE
  constructor(cameraPos) {
    const pos = cameraPos || [20, 20, 20]
    this.camera.position.set(...pos)
    this.renderer.setClearColor(0x000f32)
    this.renderer.setSize(opt.width, opt.height)
    this.renderer.setPixelRatio(window.devicePixelRatio)
  }
  setControls(camera) {
    this.controls = new OrbitControls(camera, this.renderer.domElement)
  }
}